package com.shop.flowershopmanager.service;

import com.shop.flowershopmanager.dao.SalesRecordDao;
import com.shop.flowershopmanager.entity.SalesRecord;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SalesRecordServiceImpl implements SalesRecordService {

    @Resource
    private SalesRecordDao salesRecordDao;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<SalesRecord> querySalesRecord(Integer sId) {
        return salesRecordDao.querySalesRecord(sId);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public int deleteSalesRecordById(int id) {
        return salesRecordDao.deleteSalesRecordById(id);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public int insertSalesRecord(SalesRecord salesRecord) {
        return salesRecordDao.insertSalesRecord(salesRecord);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public int updateSalesRecord(SalesRecord salesRecord) {
        return salesRecordDao.updateSalesRecord(salesRecord );
    }
}
